home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / snip0493.zip / XSTRCAT.C < prev    next >
C/C++ Source or Header  |  1993-04-05  |  696b  |  33 lines

  1. /*
  2. **  XSTRCAT.C - String concatenation function
  3. **
  4. **  Notes: 1st argument must be a buffer large enough to contain the
  5. **         concatenated strings.
  6. **
  7. **         2nd thru nth arguments are the string to concatenate.
  8. **
  9. **         (n+1)th argument must be NULL to terminate the list.
  10. */
  11.  
  12. #include <stdarg.h>
  13.  
  14. char *xstrcat(char *des, char *src, ...)
  15. {
  16.         char *destination = des;
  17.         va_list v;
  18.  
  19.         va_start(v, src);
  20.  
  21.         while (src != 0)
  22.         {
  23.                 while (*src != 0)
  24.                         *des++ = *src++;
  25.                 src = va_arg(v, char *);
  26.         }
  27.         *des = 0;
  28.  
  29.         va_end(v);
  30.  
  31.         return destination;
  32. }
  33.